import os
import time
import telnetlib
import subprocess
def curls(frequency, port, host, timeout):
    frequency = frequency + 1
    for s in range(1,frequency):
        dev_Null = open(os.devnull,'w')
        cm = 'curl ' + 'http://' + host
        p = subprocess.Popen(cm, stdout=dev_Null)
        if os.system('echo %errorlevel%') == 0:
            print("第[ %s ]次测试成功" %s)
        else:
            print("第[ %s ]次测试失败" %s)
        time.sleep(1)
up = time.time()
print("开始时间：", up)
curls(frequency=10, port=80, host='baidu.com', timeout=3)
en = time.time()
print("结束时间:", en)
xc = en - up
print("耗时:",xc)